package filter;

import org.apache.rocketmq.client.exception.MQClientException;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.common.message.Message;
import org.apache.rocketmq.remoting.common.RemotingHelper;

import java.nio.charset.StandardCharsets;

public class Producer {
    public static void main(String[] args) throws Exception {
        DefaultMQProducer producer = new DefaultMQProducer("filterTagProducerGroup");
        producer.setNamesrvAddr("127.0.0.1:9876");
        producer.start();
        Message msg = new Message("filterTagTopic",
                "tagA",
                "tagA的消息".getBytes(StandardCharsets.UTF_8)
        );
// 设置一些属性
        msg.putUserProperty("a", "1");
        msg.putUserProperty("b", "abc");
        SendResult sendResult = producer.send(msg);

        producer.shutdown();
    }
}
